package com.pay.bean;

import com.tmt.annotation.EnumDescriptor;
import com.tmt.annotation.parser.EnumAnnotationParser;

public enum WxTradeState {

    @EnumDescriptor(title="支付成功")
    SUCCESS,

    @EnumDescriptor(title="转入退款")
    REFUND,

    @EnumDescriptor(title="未支付")
    NOTPAY,

    @EnumDescriptor(title="已关闭")
    CLOSED,

    @EnumDescriptor(title="已撤销(刷卡支付)")
    REVOKED,

    @EnumDescriptor(title="用户支付中")
    USERPAYING,

    @EnumDescriptor(title="支付失败(其他原因，如银行返回失败)")
    PAYERROR;

    public static WxTradeState from(String title) {
        WxTradeState state = EnumAnnotationParser.convertFromTitle(WxTradeState.class, title);
        return state != null ? state : PAYERROR;
    }

}
